import { Models } from '../common/typings/modle'
import { ParameterException } from '../core/HttpException'

export default async function verificationCodeValidator(ctx: Models.Ctx, next: Function) {
  const { smsCode } = ctx.request.body as any
  if (ctx.session!.smsCode !== smsCode) { 
    throw new ParameterException('验证码错误')
  }
  await next()
}
